<%-- 
    Document   : logoutaction
    Created on : Dec 8, 2009, 3:36:53 PM
    Author     : gabriel
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="br.com.zumbits.avd.web.client.Conn" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Another Disk Virtual</title>
        <%
            Conn c = (Conn) session.getAttribute("conn");
            String session_id = session.getAttribute("session_id").toString();
            String currentpath = request.getParameter("currentPath");
            String name = request.getParameter("name");

            if (c != null && name != null) {
                String statusdelete = c.delete(session_id, currentpath, name).getStatus();

                if (statusdelete.equals(Conn.DELETE_SUCCESS)) {
                    response.sendRedirect("startpage.jsp?currentPath=" + currentpath);
                } else if (statusdelete.equals(Conn.DELETE_NOT_LOGGED_IN)) {
                    session.removeAttribute("username");
                    session.removeAttribute("conn");
                    session.setAttribute("message", "Voc&ecirc; n&atilde;o est&aacute; logado no sistema");
                    response.sendRedirect("index.jsp");
                }
            }
        %>
    </head>
    <body>
        <h1>Redirecionando...</h1>
    </body>
</html>
